const common = {
  state: {
    executeType: '',
    isChina: process.env.VUE_APP_REGION, // us、cn
    isLoading: false, // 是否加载首屏动画，true为加载，默认不加载
    unreadCount: 0, // 未读通知信息
    notifications: null, // 通知信息
    eventNotify: false, // event是否通知
    inkindNotify: false, // inkind红点提示
    surveyNotify: false, // survey红点提示
    isShowAdavter: false, // 是否显示广告
    isShowIconAdavter: false,
    isShowIconAdavter0: false,
    showAside: true,
    open: null,
    drdpSetting: false,
    noClassReloadingTitle: 0, // 健康卡设置班级为空时刷新标题头 防止未及时刷新可以误入出席功能
    refreshSignReview: [] // 获取健康审核数据的 Id, 用来进行是否有新消息的判断
  },
  mutations: {
    SET_EXECUTETYPE (state, type) {
      state.executeType = type
    },
    SET_LOADING (state, flag) {
      state.isLoading = flag
    },
    SET_UNREADCOUNT (state, num) {
      state.unreadCount = num
    },
    SET_NOTIFICATIONS (state, data) {
      state.notifications = data
    },
    SET_EVENTNOTIFY (state, bool) {
      state.eventNotify = bool
    },
    SET_INKINDNOTIFY (state, bool) {
      state.inkindNotify = bool
    },
    SET_SURVEYNOTIFY (state, bool) {
      state.surveyNotify = bool
    },
    //
    SET_ISSHOWADVTER (state, bool) {
      state.isShowAdavter = bool
    },
    SET_ISSHOWICONADVTER (state, bool) {
      state.isShowIconAdavter = bool
    },
    SET_ISSHOWICONADVTER0 (state, bool) {
      state.isShowIconAdavter0 = bool
    },
    SET_SHOWASIDE (state, bool) {
      state.showAside = bool
    },
    SET_DRDPSETTING (state, bool) {
      state.drdpSetting = bool
    },
    SET_OPEN (state, obj) {
      state.open = obj
    },
    SET_REFRESHSIGNREVIEW (state, array) {
      state.refreshSignReview = array
    },
    SET_RELOADINGTITLE_TITLE (state) {
      state.noClassReloadingTitle = state.noClassReloadingTitle + 1
    }
  },
  actions: {
    setExecuteType ({ commit }, type) {
      commit('SET_EXECUTETYPE', type)
    },
    setIsLoadingAction ({ commit }, flag) {
      commit('SET_LOADING', flag)
    },
    setNotificationsAction ({ commit }, data) {
      commit('SET_NOTIFICATIONS', data)
    },
    setShowAdvterAction ({ commit }, flag) {
      commit('SET_ISSHOWADVTER', flag)
    },
    setShowIconAdvterAction ({ commit }, flag) {
      commit('SET_ISSHOWICONADVTER', flag)
    },
    setShowIconAdvterAction0 ({ commit }, flag) {
      commit('SET_ISSHOWICONADVTER0', flag)
    },
    setShowAside ({ commit }, flag) {
      commit('SET_SHOWASIDE', flag)
    },
    setDrdpSetting ({ commit }, flag) {
      commit('SET_DRDPSETTING', flag)
    },
    setReloadingTitle ({ commit }) {
      commit('SET_RELOADINGTITLE_TITLE')
    }
  }
}

export default common
